#!/usr/bin/env python

import random
import pickle
import sys

r = random.Random()

def main():
    """ This tool creates a mock data file to help in quickly testing the BBS system """
    usage = "Usage: " + sys.argv[0] + " [DATA FILE PATH]"
    dFilePath = ""    

    if len(sys.argv) != 2:
        print usage
        exit()
    else:
        dFilePath = sys.argv[1]
        

    users = ["Bob", "Alice", "Eve", "Gary", "John", "Ralph"]
    topics = ["For Sale", "New in Town", "Advice", "Programming Questions", "Sports", "Hunting"]
    subjects = ["Unknown Album", "Need a restaurant recommendation", "Sports bar meetup", "Python", "Mother-in-Law gone crazy", 
                "Auto mechanic?", "Facebook is too new school", "2007 Chevy Tahoe"]
    
    serverData = []

    for postNum in range(0, 4):
        # Generate a post
        user = r.choice(users)
        topic = r.choice(topics)
        subject = r.choice(subjects)
        body = "This is post number " + str(postNum) + " in a randomly generated sequence"
        serverData.append((topic, subject, user, body))
    
    print repr(serverData)        
        
    out = open(dFilePath, "w")
    pickle.dump(serverData, out)
    out.close()

if __name__=="__main__":
    main()
